﻿using KAKA.Domain;
using Morus.Infrastructure;
using System.Collections.Generic;
using System.Linq;

namespace KAKA.Repository
{
    public interface IDictionaryRepository : IRepository<Dictionary>
    {
        IEnumerable<Dictionary> FindByType(string type);
    }

    public class DictionaryRepository : Repository<Dictionary>, IDictionaryRepository
    {
        public DictionaryRepository(Database database)
            : base(database)
        {
        }

        public IEnumerable<Dictionary> FindByType(string type)
        {
            return base.Find(Spec<Dictionary>.Eval(r => r.Type == type)).ToArray();
        }
    }
}
